/*
 * @Description: 具体信息弹窗
 * @Author: ZzT
 * @Date: 2023-03-03 18:10:16
 * @LastEditTime: 2023-03-10 17:42:46
 */
import JPModal from '@/components/JPComponents/JPModal';
import { Button, Descriptions, Divider, Empty, Space } from 'antd';
import classNames from 'classnames/bind';
import styles from '../styles/searchResult.module.scss';

const cx = classNames.bind(styles);
const Information = (props: any) => {
  const { visible, onClose, data } = props;
  const { archiveItemDetailList, archiveType, fonds } = data;
  console.log('data', data);
  const project = archiveItemDetailList?.find((item: any) => item.archiveItemLevel.level === 2);
  const records = archiveItemDetailList?.find((item: any) => item.archiveItemLevel.level === 1);
  const file = archiveItemDetailList?.find((item: any) => item.archiveItemLevel.level === 0);

  return (
    <JPModal
      visible={visible}
      onCancel={onClose}
      title="文件信息"
      footer={[
        <Button key={'ok'} onClick={() => onClose()}>
          关闭
        </Button>
      ]}
    >
      {archiveItemDetailList.length === 0 ? (
        <Empty />
      ) : (
        <Descriptions>
          <Descriptions.Item label="全宗" span={3}>
            {fonds.fondName}
          </Descriptions.Item>
          <Descriptions.Item label="档案类型" span={3}>
            {archiveType.atName}
          </Descriptions.Item>
          <Descriptions.Item label="所属项目" span={3}>
            <div className={cx('between')}>
              <Space direction="vertical">
                {project?.archiveItemDetail?.title}
                <div>项目号：8768</div>
              </Space>
              <Button type="link">查看</Button>
            </div>
            <div></div>
          </Descriptions.Item>
          <Descriptions.Item label="所属案卷" span={3}>
            <div className={cx('between')}>
              <Space direction="vertical">
                {records?.archiveItemDetail.title}
                <div>案卷档号：{records?.archiveItemDetail.arc_no}</div>
              </Space>
              <Button type="link">查看</Button>
            </div>
          </Descriptions.Item>
          <Descriptions.Item label="所属文件" span={3}>
            <div className={cx('between')}>
              <Space direction="vertical">
                {file?.archiveItemDetail.title}
                <div>文件档号：{file?.archiveItemDetail?.arc_no}</div>
              </Space>
              <Button type="link">查看</Button>
            </div>
          </Descriptions.Item>
          <Descriptions.Item span={3}>
            <Divider />
          </Descriptions.Item>
        </Descriptions>
      )}
    </JPModal>
  );
};
export default Information;
